package soundsystem;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by EricChen on 29/12/2016.
 */

@Configuration
public class CDPlayerConfig {

    @Bean(name = "lonelyHeartsClubBand")
    ///@Bean 会告诉 Spring 这个方法会返回一个对象
    public CompactDisc sgtPeppers(){
        return new SgtPeppers();
    }

    @Bean
    public CDPlayer cdPlayer() {
        return new CDPlayer(sgtPeppers());
    }

    @Bean
    public CDPlayer cdPlayer(CompactDisc compactDisc) {
        return new CDPlayer(compactDisc);
    }

}
